import json
# from http.client import responses

import requests

# url = "http://httpbin.org/get?name=qiku"
#
# response = requests.get(url,params={
#     "age":15,
#    'addr':"东三街18号"
# })
# print(response.status_code)
# if response.status_code == 200:
    # print(response.content)
    # response_text = response.content.decode("utf-8")
    # response_json1 = json.loads(response_text)
    # print(response_json1["args"],response_json1["headers"]["User-Agent"])


    # print(response.text)
    # response_json = json.loads(response.text)
    # print(response_json["args"],response_json["headers"]["User-Agent"])

    #
    #
    # print(response.json()["args"],response.json()["headers"]["User-Agent"])

url = "http://httpbin.org/post?name=qiku"

data={
    "age":15,
    'addr':"东三街18号"
}
json_data = {
    'age':15
}
# response = requests.post(url,data = data)
response = requests.post(url,json = json_data)
print(response.status_code)
if response.status_code == 200:
    # print(response.content)
    response_text = response.content.decode("utf-8")
    response_json1 = json.loads(response_text)
    print(response_json1["args"],response_json1["headers"]["User-Agent"])


# url  = "https://img0.baidu.com/it/u=969112144,3933386514&fm=253&fmt=auto&app=138&f=JPEG?w=750&h=500"
#
# response = requests.get(url)
# if response.status_code == 200:
#     with open("static/baidu.jpg","wb") as f:
#         f.write(response.content)
# print(response.content)




